/* 
Scenic Graphics Library
Copyright (C) 2007 Jouni Tulkki

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USApackage scenic;
*/

#ifndef Scenic_Renderer_Util_h
#define Scenic_Renderer_Util_h

namespace Scenic
{
namespace Renderer
{

class RGBAFloat
{
public:
	float red;
	float green;
	float blue;
	float alpha;

	int getRGBA32() const;
};

class Float2
{
public:
	float x;
	float y;
};

class Double2
{
public:
	double x;
	double y;
};

class Affine2
{
public:
	double m00;
	double m01;
	double m10;
	double m11;
	double dx;
	double dy;

	Affine2 inverse();
	Double2 transform(const Double2 &p)
	{
		Double2 r;
		
		r.x = p.x * m00 + p.y * m01 + dx;
		r.y = p.x * m10 + p.y * m11 + dy;
		
		return r;
	}

	double det() {
		return m00 * m11 - m01 * m10;
	}
};

bool convert(char *src, int srcPitch, Format srcFormat, char *dest, int dstPitch, Format dstFormat,
	int width, int height);

}
}

#endif
